<template>
  <div
    class="AsideList"
    :class="{ active: active }"
    @click="$emit('listclick')"
  >
    <span><slot></slot></span>
    <div class="icon flex justify-end">
      <el-button type="primary" text @click="$emit('edit')">
        <el-icon><Edit /></el-icon
      ></el-button>
      <el-popconfirm title="确认删除该分类吗？" confirm-button-text="确认" cancel-button-text="取消" @confirm="$emit('comfirm')">
        <template #reference>
         <el-button type="primary" text @click="$emit('close')">
        <el-icon><Close /></el-icon>
      </el-button>
        </template>
      </el-popconfirm>
    </div>
  </div>
</template>
<script setup>
defineProps({
  active: {
    type: Boolean,
    default: false,
  },
});

defineEmits(["edit", "close", "listclick","comfirm"]);

function closeClick() {}

function editClick() {}

defineExpose({
  closeClick,
  editClick,
});
</script>

<style lang="less" scoped>
.AsideList {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 45px;
  padding: 5px;

  .el-button {
    padding: 0;
    margin: 0;
    margin-right: 5px;
  }
}

.AsideList:hover,
.active {
  @apply bg-blue-100;
}
</style>